/**
 * @author Caius
 * @description 定义公共配置bean
 * @version 1.0
 * @since Created in 2024-12-31
 */

package com.itsense.stock.config;

import com.itsense.stock.pojo.vo.StockInfoConfig;
import com.itsense.stock.utils.IdWorker;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.annotation.Id;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@EnableConfigurationProperties({StockInfoConfig.class})
public class CommonConfig {
    /**
     * 定义密码加密,匹配bean
     * @return
     */
    @Bean
    public PasswordEncoder passwordEncoder(){
        return new BCryptPasswordEncoder();
    }

    /**
     * 参数1: 机器ID
     * 参数2: 机房ID
     * 由运维人员决定这些唯一性ID
     * @return
     */
    @Bean
    public IdWorker idWorker(){
        return new IdWorker(1l,2l);
    }
}
